Microcontroller units (MCUs) are small computers formed on integrated circuits. MCUs provide embedded control of a wide range of devices, such as office machines, appliances, automobile engine control systems, implantable medical devices, power tools, toys, etc.
MCUs include a central processing unit (CPU) and memory. The memory can be divided into program memory, which typically takes form in flash memory, and data memory, which typically takes form in random access memory (RAM). Data memory contains special function registers and general purpose registers that store data used by the CPU. Program memory stores a reset program and a main program. The reset program is executed by the CPU when the MCU is first started or otherwise reset. The CPU then executes the main program. Separate address spaces may exist for the program memory and the data memory.
MCUs also include programmable peripherals such as analog-to-digital converters (ADCs), digital-to-analog converters (DACs), comparators, timers, serial communication interfaces (SCIs), universal asynchronous receiver/transmitters (UARTs), etc. In general, peripherals cooperate with the CPU to improve overall MCU performance. Operational aspects of peripherals are controlled according to control values that are generated by the CPU while executing the main program. Drivers can provide software interfaces that enable the CPU to write control values to respective control registers of the peripherals.